package com.eschool.util;

import com.microsoft.sqlserver.jdbc.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JdbcUtil {
	
	
	public static Connection openConnection() {
		Connection con = null;
		try {
	         
	         Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
	         con = DriverManager.getConnection("jdbc:sqlserver://localhost;databaseName=eSchool;username=Khalid;password=king");
		} catch (ClassNotFoundException ex) {
	         ex.printStackTrace();
	    } catch (SQLException ex) {
	         ex.printStackTrace();
	    } finally {
	    	return con;
	    }
	}
	
}
